package com.mzpai.product.service.impl;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.mzpai.product.mapper.ShippingConfigMapper;
import com.mzpai.product.model.ShippingConfig;
import com.mzpai.product.service.ShippingConfigService;
import com.mzpai.service.impl.BaseServiceImpl;
/**
 *
 * <b>门店-运费配置信息 | Service</b><br>
 *
 * yanglijun 2021-04-05 21:56:48
 * 
 *  @version 1.0.0
 *
 */
@Service
public class ShippingConfigServiceImpl extends BaseServiceImpl<ShippingConfig> implements ShippingConfigService {

	Logger logger = LoggerFactory.getLogger(ShippingConfig.class);

	@Autowired 
	private ShippingConfigMapper mapper;

	@Override
	public BigDecimal getShippingAmount(String storeId) {
		Map<String, Object> map = new HashMap<String,Object>();
		map.put("storeId", storeId);
		List<ShippingConfig> list = mapper.getList(map);
		if(list.isEmpty()) {
			return new BigDecimal(0);
		}
		return list.get(0).getStoreFreePostage();
	}
}